package com.tuozixuan.javafx.shape;


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.stage.Stage;

public class EllipseDemo extends Application {
	
    public static void main(String[] args) {
        launch(args);
    }

	@Override
	public void start(Stage primaryStage) throws Exception {
		
		Ellipse ellipse = new Ellipse();
		ellipse.setCenterX(150);
		ellipse.setCenterY(150);
		ellipse.setRadiusX(100);
		ellipse.setRadiusY(50);
		
		ellipse.setStroke(Color.RED);
		ellipse.setStrokeWidth(2);
		
		ellipse.setFill(Color.BLUE);
		
		// 矩形移动到鼠标的位置
        Scene scene = new Scene(new Group(ellipse), 300, 300);
        

        // 设置左上角图标
        primaryStage.getIcons().add(new Image("see.png"));
        primaryStage.getIcons().addAll(new Image("see.png"), new Image("see.png"));
        
        // 设置标题
        primaryStage.setTitle("Welcome to JavaFX!");
        
        primaryStage.setScene(scene);
        primaryStage.sizeToScene();
        primaryStage.show();
        
        // 隐藏窗体
        primaryStage.hide();
        primaryStage.show();
        
        // 关闭窗口，相当于点击窗口关闭图标
        //primaryStage.close();
	}

}
